home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tool-inc.zip / CHARBIT.INC < prev    next >
Text File  |  1989-06-02  |  8KB  |  199 lines

  1.  
  2.  
  3. (*
  4.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  5.  *
  6.  * This is a component of the ProDoor System.
  7.  * Do not distribute modified versions without my permission.
  8.  * Do not remove or alter this notice or any other copyright notice.
  9.  * If you use this in your own program you must distribute source code.
  10.  * Do not use any of this in a commercial product.
  11.  *
  12.  *)
  13.  
  14. (*
  15.  * Function:     char_bit(char, int, int): boolean
  16.  *
  17.  * Description:  Get the specified pixel bit in a character.
  18.  *               The rom character set is used for all but special
  19.  *               characters (128..255).
  20.  *
  21.  * Inputs:       the ascii character
  22.  *               the scan line number 1..8
  23.  *               the scan column 1..8
  24.  *
  25.  * Outputs:      true if the specified bit is set (lit)
  26.  *
  27.  *)
  28.  
  29. function char_bit(ch:        char;
  30.                   scanline:  integer;
  31.                   scancol:   integer):  boolean;
  32. type
  33.    rom_character = array [1..8] of byte;
  34.    string8       = string[8];
  35.  
  36. var
  37.    char_table:    array[#0..#127] of rom_character  absolute $F000:$FA6E;
  38.                              { this is the character set in the bios
  39.                                rom which is used in text display
  40.                                in graphic video modes.  unfortunately,
  41.                                this table does not include codes > #127 }
  42.  
  43.    function special_char(l1,l2,l3,l4,l5,l6,l7,l8: string8): boolean;
  44.                              { return the pixel bits for a special char
  45.                                that is not in the rom.  this is called with
  46.                                8 strings that give a "picture" of how
  47.                                the character should look on the output }
  48.    var
  49.       line:  string8;
  50.  
  51.    begin
  52.       case scanline of
  53.          1:  line := l1;
  54.          2:  line := l2;
  55.          3:  line := l3;
  56.          4:  line := l4;
  57.          5:  line := l5;
  58.          6:  line := l6;
  59.          7:  line := l7;
  60.          8:  line := l8;
  61.       end;
  62.  
  63.       special_char := (line[scancol] <> ' ');
  64.    end;
  65.  
  66.  
  67. begin  {char_bit}
  68.  
  69.    { look up the special characters that are not in the rom }
  70.  
  71.    case ch of
  72.          '┌','╒','╓','╔':
  73.                char_bit := special_char('        ',
  74.                                         '        ',
  75.                                         '        ',
  76.                                         '   #####',
  77.                                         '   #####',
  78.                                         '   ##   ',
  79.                                         '   ##   ',
  80.                                         '   ##   ');
  81.  
  82.          '┐','╕','╖','╗':
  83.                char_bit := special_char('        ',
  84.                                         '        ',
  85.                                         '        ',
  86.                                         '#####   ',
  87.                                         '#####   ',
  88.                                         '   ##   ',
  89.                                         '   ##   ',
  90.                                         '   ##   ');
  91.  
  92.          '└','╘','╙','╚':
  93.                char_bit := special_char('   ##   ',
  94.                                         '   ##   ',
  95.                                         '   ##   ',
  96.                                         '   #####',
  97.                                         '   #####',
  98.                                         '        ',
  99.                                         '        ',
  100.                                         '        ');
  101.  
  102.          '┘','╛','╜','╝':
  103.                char_bit := special_char('   ##   ',
  104.                                         '   ##   ',
  105.                                         '   ##   ',
  106.                                         '#####   ',
  107.                                         '#####   ',
  108.                                         '        ',
  109.                                         '        ',
  110.                                         '        ');
  111.  
  112.          '│','║':
  113.                char_bit := special_char('   ##   ',
  114.                                         '   ##   ',
  115.                                         '   ##   ',
  116.                                         '   ##   ',
  117.                                         '   ##   ',
  118.                                         '   ##   ',
  119.                                         '   ##   ',
  120.                                         '   ##   ');
  121.  
  122.          '─','═':
  123.                char_bit := special_char('        ',
  124.                                         '        ',
  125.                                         '        ',
  126.                                         '########',
  127.                                         '########',
  128.                                         '        ',
  129.                                         '        ',
  130.                                         '        ');
  131.  
  132.          '┤','╡','╣','╢':
  133.                char_bit := special_char('   ##   ',
  134.                                         '   ##   ',
  135.                                         '   ##   ',
  136.                                         '#####   ',
  137.                                         '#####   ',
  138.                                         '   ##   ',
  139.                                         '   ##   ',
  140.                                         '   ##   ');
  141.  
  142.          '├','╞','╠','╟':
  143.                char_bit := special_char('   ##   ',
  144.                                         '   ##   ',
  145.                                         '   ##   ',
  146.                                         '   #####',
  147.                                         '   #####',
  148.                                         '   ##   ',
  149.                                         '   ##   ',
  150.                                         '   ##   ');
  151.  
  152.          '┴','╨','╧','╩':
  153.                char_bit := special_char('   ##   ',
  154.                                         '   ##   ',
  155.                                         '   ##   ',
  156.                                         '########',
  157.                                         '########',
  158.                                         '        ',
  159.                                         '        ',
  160.                                         '        ');
  161.  
  162.          '┬','╥','╤','╦':
  163.                char_bit := special_char('        ',
  164.                                         '        ',
  165.                                         '        ',
  166.                                         '########',
  167.                                         '########',
  168.                                         '   ##   ',
  169.                                         '   ##   ',
  170.                                         '   ##   ');
  171.  
  172.          '┼','╪','╫','╬':
  173.                char_bit := special_char('   ##   ',
  174.                                         '   ##   ',
  175.                                         '   ##   ',
  176.                                         '########',
  177.                                         '########',
  178.                                         '   ##   ',
  179.                                         '   ##   ',
  180.                                         '   ##   ');
  181.  
  182.          '_':  char_bit := special_char('        ',
  183.                                         '        ',
  184.                                         '        ',
  185.                                         '        ',
  186.                                         '        ',
  187.                                         '        ',
  188.                                         '########',
  189.                                         '########');
  190.  
  191.          ^@..#127:    {these characters are in the rom}
  192.             char_bit := (char_table[ch][scanline] and ($100 shr scancol)) <> 0;
  193.  
  194.          else         {invalid characters will be printed as solid blocks}
  195.             char_bit := true;
  196.    end;
  197. end;
  198.  
  199.